home *** CD-ROM | disk | FTP | other *** search
/ Workbench Design / WB Collection.iso / workbench werkzeuge / memory & system tools / vmm / doc / vmm.guide (.txt) < prev    next >
Amigaguide Document  |  1996-04-07  |  58KB  |  1,090 lines

  1. @database doc/VMM.guide
  2. @Node Main "VMM/doc/VMM.guide"
  3. @Next "COPYRIGHT"
  4.                                   VMM 
  5.                (Virtual Memory Manager for Amigas with MMU)
  6.                               User's Guide
  7.                               Version 3.3
  8.                       $Date: 95/12/16 18:50:27 $
  9.                          written by Martin Apel
  10.                          email: apel@tecmath.de
  11. CONTENTS
  12.   0. @{" Shareware notice      " Link "COPYRIGHT"}
  13.   1. @{" Introduction          " Link "INTRODUCTION"}
  14.   2. @{" Requirements          " Link "REQUIREMENTS"}
  15.   2. @{" Installation          " Link "INSTALLATION"}
  16.   3. @{" Changes               " Link "CHANGES"}
  17.   4. @{" The preferences window" Link "VMMPREFS"}
  18.   5. @{" Processor differences " Link "PROC_DIFFS"}
  19.   6. @{" Problems              " Link "PROBLEMS"}
  20.   7. @{" Troubleshooting       " Link "TROUBLESHOOTING"}
  21.   8. @{" Technical description " Link "TECHNICAL_DES"}
  22.   9. @{" VMM.library           " Link "VMM_LIBRARY"}
  23.  10. @{" External programs     " Link "EXT_PROGS"} 
  24.  11. @{" Known bugs            " Link "KNOWN_BUGS"}
  25.  12. @{" Bug reports           " Link "BUG_REPORTING"}
  26.  13. @{" Acknowledgments       " Link "ACKNOWLEDGMENTS"}
  27.  14. @{" Miscellaneous         " Link "MISCELLANEOUS"}
  28. @EndNode
  29. @Node "COPYRIGHT" "VMM/doc/VMM.guide/COPYRIGHT"
  30. @Next "INTRODUCTION"
  31. @Prev "Main"
  32. @Toc "Main"
  33. I have decided to make VMM shareware.  I have invested about one and a
  34. half  year  in  developing  VMM  and it seems there are quite a lot of
  35. people  really  using  it.  So I decided towards the following policy:
  36. You  are  allowed  to test VMM for thirty days to find out if it suits
  37. your  needs.   If  you  actually use it you are requested to register.
  38. The  registration  fee  is  30 DM, 20 US-$ or equivalent.  There is no
  39. different registered version, this version of VMM is fully functional.
  40. You  can send cash, euro-cheques or transfer money to my bank account.
  41. See  @{"Miscellaneous"  Link  "MISCELLANEOUS"}  for my address and bank account.   As  a  service 
  42. for  registered  users  I  will  notify you about new versions, if you
  43. supply an e-mail address.
  44. IMPORTANT NOTICE:  This program is copyrighted by Martin Apel, but can
  45. be   freely   distributed,  provided  that  the  following  rules  are
  46. respected:
  47. - No change is made to the program nor to the accompanying documentation
  48. - The  package  is always distributed in its complete form.
  49. - Every  form  of distribution is allowed and encouraged, but no fee can
  50.   be charged for this program except for, possibly, the cost of magnetic
  51.   media and/or disk duplication and shipping.
  52. - Inclusion  in  software  libraries  such as Fish Disks is allowed,
  53.   provided  the  fees  charged for these disks are comparable with those
  54.   charged by Fred Fish.
  55. - The  program  cannot  be distributed in any commercial product without
  56.   the written consent of the author.
  57. By  copying,  distributing  and/or  using  the program you indicate your
  58. acceptance of the above rules.
  59. @EndNode
  60. @Node "INTRODUCTION" "VMM/doc/VMM.guide/INTRODUCTION"
  61. @Next "REQUIREMENTS"
  62. @Prev "COPYRIGHT"
  63. @Toc "Main"
  64. 1. INTRODUCTION
  65. Even  on  the  A4000  equipped  with  6 MB sometimes I longed for more
  66. memory  or,  as  an  alternative,  for  virtual  memory.  As the 68040
  67. contains  an  MMU  and  I  was  interested in learning how it works, I
  68. decided  to  write  a virtual memory manager for the Amiga myself.  It
  69. emulates  up  to  512  MB in a user selectable amount of physical RAM.
  70. From  version  3.3  VMM  supports  all  680x0  processors  with  a MMU
  71. including  the  68060.   Paging  can be done either to a partition , a
  72. normal  file  or  to  a so-called pseudo-partition, which combines the
  73. speed  of  a partition with the flexibility of a file.  See 
  74. @{"Changes from V3.2 to V3.3" Link "To_3_3"} for a description of new features.
  75. What does virtual memory mean ?
  76. In  a  virtual  memory  environment  the processor needs to be able to
  77. translate  each  address it operates on into a physical address.  This
  78. translation  is  carried out in hardware by the memory management unit
  79. (MMU)  for  each  memory  access.   Physical memory is split into page
  80. frames of equal size, VMM uses either 4 or 8 KB.  It is possible for a
  81. page  to  be  resident  in  memory  or  to be swapped out to harddisk.
  82. Whenever  the  processor tries to access a page that is swapped out, a
  83. pagefault  occurs.   VMM  suspends  the  task  causing  the pagefault,
  84. fetches  the corresponding page from disk and installs it somewhere in
  85. physical  memory.   When  the  page  is in physical memory the task is
  86. allowed  to  resume.   This process is carried out transparently, i.e.
  87. the task causing the pagefault has no knowledge of what happened.  The
  88. only  visible  thing  is  that  memory access time for that access has
  89. increased  significantly.   For further information how virtual memory
  90. works in general, see one of the following books:
  91.   Operating systems - Design and implementation
  92.   Andrew Tanenbaum
  93.   Prentice Hall
  94.   Operating system concepts   
  95.   Silberschatz, Galvin
  96.   Addison Wesley
  97. How does VMM achieve virtual memory management on the Amiga ?
  98. Unfortunately  the  Amiga  operating  system  has  not been written to
  99. support virtual memory, so this program is kind of a hack.  I tried to
  100. keep  everything as system-friendly as possible, but there are certain
  101. situations  when VMM might crash the system.  This is not VMM's fault,
  102. but  the  thoughtlessness  of the Amiga's developers regarding virtual
  103. memory.
  104. VMM  installs  a  standard  memory list in ExecBase, so virtual memory
  105. will be handled just like other memory.  VM is allocated only when the
  106. MEMF_PUBLIC  flag in the allocation is not set.  Otherwise system data
  107. such  as  task control blocks and IORequests might be paged out, which
  108. would  lead to failure.  From V3.0 code can be put into virtual memory
  109. as  well.   From  V1.3  this  mechanism  has  been  extended  to  make
  110. non-behaving programs work together with VMM.
  111. @EndNode
  112. @Node "REQUIREMENTS" "VMM/doc/VMM.guide/REQUIREMENTS"
  113. @Next "INSTALLATION"
  114. @Prev "INTRODUCTION"
  115. @Toc "Main"
  116. VMM  needs  a  working  MMU in your system.  Make sure that you have a
  117. processor  with an MMU in it, an EC type will not work.  For VMM there
  118. is  no way to find out if you have a processor equipped with an MMU or
  119. not,  because Motorola sells those processors as EC types which failed
  120. their  MMU  test.   So  the  MMU  on  your  chip might be nearly fully
  121. functional but does not work correctly under all circumstances.
  122. You  should also have a harddisk although you could theoretically page
  123. to some other block-oriented device as well.  Additionally you need at
  124. least 2 MB of RAM.
  125. On  the  software side VMM requires at least OS2.0 to run.  With OS2.1
  126. you can benefit from localization features.  For the user interface at
  127. least MUI 2.3 (V10) is needed.
  128. @EndNode
  129. @Node "INSTALLATION" "VMM/doc/VMM.guide/INSTALLATION"
  130. @Next "CHANGES"
  131. @Prev "REQUIREMENTS"
  132. @Toc "Main"
  133. 2. INSTALLATION
  134. There  are  two  ways  to  install  VMM  on  your  system.  There's an
  135. installer  script provided which does all the necessary setup for you.
  136. Simply  click on the icon from Workbench and it will guide you through
  137. the  installation  step  by  step.   I  strongly  recommend  using the
  138. installer script, because VMM has grown in size.  If you would like to
  139. install  the  french version you currently have to install the english
  140. version first and install the catalog files by hand.
  141. If  you  don't  like  to use the installer script, you can install VMM
  142. manually.  You have to execute the following steps to do this:
  143. There are two versions of the main program, one for a pagesize of 4 KB
  144. and  one for 8 KB.  You have to decide, which pagesize you want to use
  145. for  paging.   Generally  a pagesize of 4 KB would be appropriate, but
  146. there  might  be cases (e.g.  on some '040 cards for the A2000), which
  147. only  work  with  8K  pages  due to the MMU setup of special processor
  148. cards.   If there's an MMU table already installed, you should use the
  149. size  used  by  that table.  Otherwise the system will probably crash.
  150. Use  the "ShowPageSize" program to find out which pagesize is possible
  151. for  your  system.   When  you  have chosen which one to use, copy the
  152. corresponding  executable  into  the  L:   directory  and rename it to
  153. "VMM-Handler".   Put  VMM  somewhere into your path or into WBStartup.
  154. If  you  have  previously  used  VMM  you  have  to  convert  your old
  155. configuration  file  to  the  new config file format.  This is done by
  156. starting 'ConvVMMCfg' once, which can be found in the 'tools' drawer.
  157. The  developer  files  can  be copied whereever you like or where your
  158. compiler expects them.
  159. The  first  time  you use VMM, you have to specify the parameters used
  160. for  paging.   This  is  done  by simply clicking onto VMM's icon from
  161. Workbench  or  by  starting  VMM from the CLI.  A sample configuration
  162. file  "VMM.prefs"  is  provided  which  you  can  use  as  a  starting
  163. configuration. 
  164. After  you  have  set  up  your initial environment you may change the
  165. tooltypes  of  VMM to "CX_POPUP=NO" to prevent VMM from displaying its
  166. window on startup.  During runtime you can always invoke the window by
  167. either  pressing VMM's hotkey (default:  ralt rshift v) or by starting
  168. VMM a second time.
  169. The following parameters can be specified when starting VMM.  They can
  170. be entered from the CLI or as tooltypes from Workbench.
  171.   CX_POPUP=YES|NO
  172.   CX_PRIORITY=<n>
  173.   CX_POPKEY=<hotkey definition>
  174.   SETTINGS=<filename>             provide another preferences file
  175.   QUIT                            This makes VMM quit if it is running
  176.   FORCE                           This stops VMM from asking whether to
  177.                                   overwrite the paging partition on
  178.                                   startup. Useful if you use the same
  179.                                   partition for VMM and e.g. LINUX.
  180. @EndNode
  181. @Node "CHANGES" "VMM/doc/VMM.guide/CHANGES"
  182. @Next "To_1_1"
  183. @Prev "INSTALLATION"
  184. @Toc "Main"
  185. 3. CHANGES
  186. @{" Changes from V1.0 to V1.1" Link "To_1_1"}
  187. @{" Changes from V1.1 to V1.2" Link "To_1_2"}
  188. @{" Changes from V1.2 to V1.3" Link "To_1_3"}
  189. @{" Changes from V1.3 to V2.0" Link "To_2_0"}
  190. @{" Changes from V2.0 to V2.1" Link "To_2_1"}
  191. @{" Changes from V2.1 to V3.0" Link "To_3_0"}
  192. @{" Changes from V3.0 to V3.1" Link "To_3_1"}
  193. @{" Changes from V3.1 to V3.2" Link "To_3_2"}
  194. @{" Changes from V3.2 to V3.3" Link "To_3_3"}
  195. @EndNode
  196. @Node "To_1_1" "VMM/doc/VMM.guide/To_1_1"
  197. @Prev "CHANGES"
  198. @Next "To_1_2"
  199. @Toc  "Main"
  200. There  were  quite  a few changes / enhancements implemented since the
  201. release of V1.0.
  202. - There  was  a  bug,  which caused VMM to page to the wrong disk on
  203.   systems with hard disks with unit numbers other than zero.
  204. - A   dynamic   memory   allocation  policy  for  page-frames  is  now
  205.   implemented.  This causes VMM to allocate a new page-frame on each
  206.   pagefault  if  possible, thus reducing disk access.  When memory is
  207.   needed  for  other  purposes, VMM will free its buffers and return
  208.   memory to the public memory pool.
  209. - Paging to a disk file is implemented now.  Unfortunately it is quite
  210.   slow due to the overhead of the AmigaDOS filing system.
  211. - VMM  should now run on all machines with a genuine 68040 processor
  212.   without problems.  It installs its own MMU table if necessary.
  213. - The   statistics   window  is  font-sensitive  now  and  gives  more
  214.   information  about  the  paging process.  Additionally a new program
  215.   "VMMStat"  is  included,  so you don't have to keep the statistics
  216.   window open all the time.
  217. - Up to 64 MB are now available for virtual memory.
  218. - Two  different  program  versions  for  pagesizes  of 4 and 8 KB are
  219.   available now.
  220. - Disk  access time is reduced by minimizing head motion of the paging
  221.   device.
  222. @EndNode
  223. @Node "To_1_2" "VMM/doc/VMM.guide/To_1_2"
  224. @Prev "To_1_1"
  225. @Next "To_1_3"
  226. @Toc  "Main"
  227. Changes from V1.1 to V1.2:
  228. - In V1.1 tasks were forbidden to allocate VM from a forbidden section
  229.   for  security  reasons.   This   has   been   changed  back  to  the
  230.   behaviour of V1.0 because of problems with AdPro.
  231. - A  small  program  "ShowPageSize"  has been added to determine which
  232.   pagesize is possible on your system.
  233. - Fixed  a bug which caused strange errors when using a page-file with
  234.   its  path  longer  than 20 characters, or paging to a partition with
  235.   the  partition  name  longer  than  20  characters.  The path of the
  236.   page-file  can  now  be  up to 80 characters, the name of the paging
  237.   partition up to 40 characters.
  238. - Maximum VM size has been increased to 128 MB as requested.
  239. - A  special library for giving VM only to dedicated programs has been 
  240.   added.   It  includes  functions  such  as  AllocVMem , FreeVMem and
  241.   AvailVMem. See vmm_lib.doc for details.
  242. @EndNode
  243. @Node "To_1_3" "VMM/doc/VMM.guide/To_1_3"
  244. @Prev "To_1_2"
  245. @Next "To_2_0"
  246. @Toc  "Main"
  247. Changes from V1.2 to V1.3:
  248. - FreeMem  now marks the freed pages as empty resulting in less paging
  249.   on freeing memory.  Unfortunately this breaks tools such as MungWall
  250.   which writes to memory it hasn't allocated.
  251. - Fixed  a  bug  which  caused  strange behaviour during disk IO using
  252.   multiple   units   sharing  the  same  device.   This  was  probably
  253.   responsible  for  some strange misbehaviours when rendering text and
  254.   icons.
  255. - The  statistics  window  is  now  "zoomable"  to  only the title bar
  256.   indicating  the  amount  of free VM.  Position and initial status of
  257.   the statistics window are configurable in VMMPrefs.
  258. - The  preferences  are  now  changeable  while  VMM  is running.  All
  259.   parameters except the paging device/file, the page-file size and the
  260.   position  of  the  statistics  window will be immediately changed by
  261.   VMM.
  262. - An  advanced  section  for  memory  allocation  has  been  added  to
  263.   VMMPrefs.  You can now determine the minimum size for VM allocations
  264.   for PUBLIC and non-PUBLIC requests separately.
  265. - Reduced VMM's usage of signals on behalf of other tasks.  There were
  266.   problems with tasks that had all their signals already allocated.
  267. - The  Wait function had to be patched in order to avoid problems with
  268.   tasks which have a stack in VM.
  269. - You  can  now  exit VMM even if there's VM still allocated.  In this
  270.   case  VMM  will  try  to  page in all this memory and set up the MMU
  271.   tables accordingly, after which it will quit.
  272. - Now  writes  out  modified  pages  before  it needs to, resulting in 
  273.   better average pagefault service times.
  274. - Added  a reset handler which inhibits a reset until paging currently
  275.   going  on  has finished.  This prevents the validate procedure after
  276.   reset if you are paging to a file.
  277. - Fixed  a bug which caused VMM to hang when writing the first page to
  278.   DMA-driven harddisks.
  279. - Some minor changes and cleanups.
  280. @EndNode
  281. @Node "To_2_0" "VMM/doc/VMM.guide/To_2_0"
  282. @Prev "To_1_3"
  283. @Next "To_2_1"
  284. @Toc  "Main"
  285. Changes from V1.3 to V2.0:
  286. - VMM runs on the 68030.  Consequently VMM40 has been renamed to VMM.
  287. - Implemented  so-called  pseudo-partition, which look like a file but
  288.   can be accessed with the speed of a partition.
  289. - VMM  is  a  commodity  in  V2.0  using  a hotkey to display its GUI.
  290.   Consequently  the  setup  of V2.0 has changed a bit.  VMM40 has been
  291.   moved to L:VMM-Handler and VMM40Prefs is now simply called VMM.  The
  292.   VMM:  assign and the StartVMM program have become obsolete.
  293. - Hopefully  fixed  bugs  having  to  do  with  paging  to DMA devices
  294.   (Patched CachePreDMA and CachePostDMA)
  295. - The  GUI has changed a bit to make room for some additionally needed
  296.   gadgets.
  297. - VMM  now patches Workbench's title bar to include the amount of free
  298.   VM. There's a configuration button to enable or disable this feature.
  299. - Better exit handling if there's still VM allocated.
  300. - Miscellaneous minor changes and bug fixes
  301. @EndNode
  302. @Node "To_2_1" "VMM/doc/VMM.guide/To_2_1"
  303. @Prev "To_2_0"
  304. @Next "To_3_0"
  305. @Toc  "Main"
  306. Changes from V2.0 to V2.1:
  307. - AvailMem  now  returns  amount  of free public memory if task is not
  308.   permitted to use virtual memory.
  309. - Fixed  a  bug  in  the startup code which caused VMM to crash if the
  310.   preferences file wasn't found.  Now a requester is displayed.
  311. - Fixed  a  bug  in  the  Installer  script  which  caused the default
  312.   configuration file not to be copied.
  313. - Implemented  a  write  buffer  to  write  multiple  pages  to  disk.
  314.   Although  this involves copying the pages to the buffer it generally
  315.   results in a quite noticeable speed improvement.
  316. - Deleted  the memory option for paging to the largest available chunk
  317.   since no-one ever seems to use it.
  318. - Paging  to  a  file  is speeded up significantly by using additional
  319.   buffers  for  the  filesystem.   FFS and OFS are very inefficient on
  320.   seeking  on  long files.  VMM installs as many buffers as are needed
  321.   to  keep  the  file list blocks of the paging file in memory.  Other
  322.   file systems such as the MSDOS filesystem don't need this.
  323. - FreeMem  now  marks  the  freed  pages as unused instead of invalid.
  324.   Previously subsequent accesses to that range of memory resulted in a
  325.   page-fault  without  any disk access but the overhead for page-fault
  326.   handling.
  327. - Corrected font calculation for statistics window.
  328. - Improved error handling.
  329. - Fixed a hard to find bug which could cause spurious crashes on 68030
  330.   systems  with a 68882.  I underestimated the amount of data which is
  331.   pushed onto the stack during a context switch if the FPU is busy.
  332. - Added  support  for  external statistics displays. You can now write
  333.   your own (possibly graphical) statistics output for VMM.
  334. - Worked  around  a  DOS  bug  which caused failure to use pseudo-par-
  335.   titions on partitions with the same volume and device name.
  336. @EndNode
  337. @Node "To_3_0" "VMM/doc/VMM.guide/To_3_0"
  338. @Prev "To_2_1"
  339. @Next "To_3_1"
  340. @Toc  "Main"
  341. Changes from V2.1 to V3.0:
  342. - Implemented  code  paging, i.e. you can put program code into VM and 
  343.   swap it out just as usual memory.
  344. - Implemented  memory  tracking.   It is now possible to determine how
  345.   much virtual memory is used by each task.
  346. - Implemented  another  mode  for specification of paging memory:  The
  347.   'restricted  dynamic  mode'  works  like  dynamic  mode  but you can
  348.   specify lower and upper bounds for paging memory.
  349. - I  wrote  a  completely  new  user  interface  using MUI.  This also
  350.   supports localization.
  351. - Hopefully  fixed problems with some processor cards (Better handling
  352.   of transparent translation registers).
  353. - Additionally  implemented a 'custom MMU setup' which should make all
  354.   those nasty boards work which previously had problems with VMM's MMU
  355.   setup.
  356. - VMM can now be controlled using ARexx.
  357. - VMM now supports machines equipped with a 68020 + 68851 combination.
  358. - Fixed  a  bug  which  caused  VMM  to  display a message "Not enough
  359.   memory" when enabling statistics while VMM was running.
  360. - Fixed  a  race  condition  which  could  cause  VMM to crash when it
  361.   received  a  message  from  an  external  statistics  program during
  362.   program exit time.
  363. - The  format  of  the  configuration  file  has  changed  to a binary
  364.   description.   There  is a program provided to convert the old style
  365.   prefs file into the new representation.
  366. @EndNode
  367. @Node "To_3_1" "VMM/doc/VMM.guide/To_3_1"
  368. @Prev "To_3_0"
  369. @Next "To_3_2"
  370. @Toc  "Main"
  371. Changes from V3.0 to V3.1:
  372. - Fixed  a  bug  which  caused  VMM  not  to  work  under  OS2.0.   An
  373.   auto-OpenLibrary  'feature' of libnix which was unknown to me caused
  374.   the  startup code to open locale.library and refuse to run if it was
  375.   not there.  This problem has been eliminated by simply disabling the
  376.   auto-OpenLibrary feature.
  377. - Added  a  new keyword 'FORCE' to the VMM tooltypes.  If specified in
  378.   the  icon  or  on  the  commandline,  VMM will not ask you if it may
  379.   overwrite  a  partition or file not previously used by VMM, but will
  380.   simply  do  so.   This  is  very  useful for people who use the same
  381.   paging partition for VMM and e.g.  LINUX.
  382. - Raised  the  VM limit from 128 MB to 512 MB after receiving multiple
  383.   requests  to  do  so.  Additionally the usage of physical memory for
  384.   MMU tables has decreased a bit under certain circumstances.
  385. - Added  a  FAST  ROM option to VMM.  Since on some machines there are
  386.   problems with tools such as CPU which map the ROM to Fast memory and
  387.   it wasn't much work I added this one.
  388. - VMM is now able to create a pseudo-partition on a DC-FFS disk.
  389. - Added  an empty-page-collector which causes unused pages to be freed
  390.   more often.  This reduces disk accesses due to pagefaults up to 30%.
  391. - Fixed a bug in the reset code which caused VMM to generate a GURU on
  392.   some machines when pressing reset.
  393. - Fixed  a  minor bug which caused VMM to try to free memory again and
  394.   again,  although  there was no memory to free.  Mostly happened when
  395.   the  system  was  short  of CHIP memory although VMM did not use any
  396.   CHIP memory.
  397. - Changed  a  bit  in  the MMU mapping when the VMM_MMU.config file is
  398.   used.   Now  memory for a pagetable is allocated on the first access
  399.   to  an address mapped by this table.  Previously VMM could not start
  400.   on  some  machines because their processor boards mapped the whole 4
  401.   GB range needing 4 MB just for pagetables.
  402. - Modified  the memory tracking such that the loadfile is displayed as
  403.   the  owner  of its code and not the loading task (most important for
  404.   libraries and devices).
  405. - Found  a  bug  which  I  have long been searching for which produced
  406.   obscure  irreproducible  crashes.  The bug is contained in ramlib in
  407.   conjunction  with  using  semaphores.   I have developed a patch for
  408.   ramlib (which is not very system-conforming) which fixes this bug.
  409. - Fixed  a minor bug which caused VMM to incorrectly accept partitions
  410.   with a blocksize other than 512 bytes for pseudo-partitions.
  411. - Worked  around  a  bug  in  GCC  which  caused VMM to always use the
  412.   default settings for code paging for the compiler passes of GCC.
  413. @EndNode
  414. @Node "To_3_2" "VMM/doc/VMM.guide/To_3_2"
  415. @Prev "To_3_1"
  416. @Next "TO_3_3"
  417. @Toc  "Main"
  418. Changes from V3.1 to V3.2:
  419. - Fixed  an  Enforcer hit which occured when the statistics window was
  420.   opened as a titlebar upon startup.
  421. - Modified  the  resethandler  stuff  to  remove  the delay that could
  422.   sometimes occur upon reset.
  423. - Fixed  a bug in ReadMMUConfig.  It generated an empty VMM_MMU.config
  424.   file when used in a setup with 8K pages.
  425. - Added  the  possibility  to enter directories into the task settings
  426.   list.   This  way  you  can  group  your files into directories with
  427.   programs  using VM and ones which should not use VM.  Note that only
  428.   files  loaded  directly  from  a  given  directory are affected, not
  429.   programs residing in a subdirectory of the given one.
  430. - VMM  now  automatically  detects swap-partitions also used by LINUX.
  431.   This  way  you  don't need to give the FORCE option to VMM, reducing
  432.   the risk to accidentally overwrite a normal partition.
  433. @EndNode
  434. @Node "To_3_3" "VMM/doc/VMM.guide/To_3_3"
  435. @Prev "To_3_2"
  436. @Next "VMMPREFS"
  437. @Toc  "Main"
  438. Changes from V3.2 to V3.3:
  439. - The  output  of  VMMUsageCLI  looks somewhat nicer now (suggested by
  440.   Steve Koren).
  441. - Each  entry  in  the  task list can now be as long as you like (i.e.
  442.   about  10000 characters).  Can be used to enter complicated patterns
  443.   (suggested by Steve Koren).
  444. - VMM now works on the 68060.
  445. - Fixed  a  bug  which  caused  VMM to crash if FastROM was enabled on
  446.   a 68030.
  447. @EndNode
  448. @Node "VMMPREFS" "VMM/doc/VMM.guide/VMMPREFS"
  449. @Next "Tasks_Gadget"
  450. @Prev "To_3_3"
  451. @Toc "Main"
  452. 4. The preferences window
  453. In  order  to  enter all the settings that are needed for VMM to work,
  454. there's  a  graphical  user  interface  using MUI.  You can change all
  455. parameters of VMM while it is running except for a few, where it would
  456. be hard and unnecessary (in my opinion) to change them during runtime.
  457. There are three major parts in the configuration of VMM:
  458. @{" Tasks / Programs " Link "Tasks_Gadget"}
  459. @{" Memory settings  " Link "Memory_Settings"}
  460. @{" Miscellaneous    " Link "Misc_Settings"}
  461. The  three  buttons  at  the  lower edge of the window cause the named
  462. actions.   Selecting 'Cancel' causes VMM to start without changing the
  463. parameters.   If  you  want  to quit VMM, use the 'Quit' item from the
  464. menu or start VMM a second time with the 'QUIT' parameter.
  465. @EndNode
  466. @Node "Tasks_Gadget" "VMM/doc/VMM.guide/Tasks_Gadget"
  467. @Next "Memory_Settings"
  468. @Prev "VMMPREFS"
  469. @Toc  "Main"
  470. Tasks / Programs list:
  471. VMM  keeps  a  list  of tasks/programs which require special attention
  472. when  using  VM and a default setting.  You can either disable virtual
  473. memory  by  default  and enter the programs which should use VM or the
  474. other  way  round.   The name you enter can either be a task name, the
  475. name  of  a  load  file  (without  path), a directory or even a normal
  476. AmigaDOS  pattern  to  specify which entity is meant to be run with or
  477. without  VM.  When using a directory the settings for this entry apply
  478. to all files residing in this directory (not in subdirectories).  Note
  479. that  this  applies  only to DOS processes created from loadfiles from
  480. this  directory,  there  is  no way to determine the loadfile which is
  481. used by a simple Exec task.
  482. For  each  entry  in  the  list  there  are two cases which have to be
  483. considered:
  484. 1. Code paging:  This determines if the program code for a file is put
  485.    into VM or not.
  486. 2. Data  paging: For data paging there are three possibilities: Use VM 
  487.    for requests with PUBLIC-bit unset, do never use VM or the advanced
  488.    options.
  489. The  advanced  section has been implemented because there are programs
  490. which  either  always allocate memory with the public flag set or they
  491. allocate  memory with the PUBLIC flag unset, where it must be set.  To
  492. make  these  programs  run  together  with  VMM,  you can tell VMM the
  493. minimum sizes to go into VM with the PUBLIC flag set or unset.  If you
  494. enter  a  value into one of the string gadgets all requests with sizes
  495. larger than the given size will be allocated in VM, e.g.  a value of 0
  496. makes all allocations with the corresponding flag settings go into VM.
  497. The  special  value -1 will tell VMM that no allocation should go into
  498. VM  for  the  corresponding  flag setting.  This is a bit difficult to
  499. explain, so I hope the following examples will make things clearer.
  500. Example 1: A program allocates all its memory with the PUBLIC flag set
  501.            and thus makes no use of VM.
  502. Solution:  Set  the  "Min  public  VM allocation" gadget to some value
  503.            e.g.   200.  You will have to try the actual value.  If you
  504.            enter  200,  all  requests  smaller than 200 bytes with the
  505.            PUBLIC  flag  set  will  go into PUBLIC memory, whereas all
  506.            larger  ones  will  go  into  VM.   Enter  0  into the "Min
  507.            non-public   VM   allocation"   gadget   to   indicate  all
  508.            allocations with the PUBLIC flag unset should use VM.
  509. Example 2: A  program allocates system structures with the PUBLIC flag
  510.            unset leading to crashes with previous versions of VMM.
  511. Solution:  Set  the "Min non-PUBLIC VM allocation" gadget to e.g.  200
  512.            and  the "Min PUBLIC VM allocation" gadget to -1.  This way
  513.            system  structures,  which are mostly well below 200 bytes,
  514.            always go into PUBLIC memory.
  515. The  "Use VM" state corresponds to a -1/0 setting of the "Min PUBLIC"/
  516. "Min  non-PUBLIC"  gadgets.   The  "Don't use VM" state corresponds to
  517. a setting of -1/-1.
  518. If  a  name matches two or more names in the task list the first entry
  519. is used.  If it doesn't match any entry the default settings are used.
  520. This   way   you   can   specify   that  e.g.   all  libraries  except
  521. muimaster.library  should  not use VM for their code by first entering
  522. 'muimaster.library'  with  code paging turned on and '#?.library' with
  523. code paging turned off.
  524. If you have problems finding out the necessary settings for a task you
  525. can  use @{"memory tracking" Link "Misc_Settings"} to  find  the name of each task using VM and 
  526. amount of virtual memory it uses.
  527. The additional buttons to add, remove or sort entries should be clear.
  528. @EndNode
  529. @Node "Memory_Settings" "VMM/doc/VMM.guide/Memory_Settings"
  530. @Prev "Tasks_Gadget"
  531. @Next "MemType_Gadget"
  532. @Toc "Main"
  533. This section determines the paging device and the configuration of 
  534. memory used for paging.
  535. @{" Memory allocation       " Link "MemType_Gadget"}
  536. @{" Memory Type             " Link "MemFlags_Gadget"}
  537. @{" Write buffer            " Link "WriteBuffer_Gadget"}
  538. @{" VM Priority             " Link "MemPri_Gadget"}
  539. @{" Swap medium             " Link "SwapMedium_Gadget"}
  540. @{" Swap file size          " Link "FileSize_Gadget"}
  541. @EndNode
  542. @Node "MemType_Gadget" "VMM/doc/VMM.guide/MemType_Gadget"
  543. @Next "MemFlags_Gadget"
  544. @Prev "Memory_Settings"
  545. @Toc  "Main"
  546. Memory allocation for pageframes:
  547. There are three policies for memory allocation:
  548. - Fixed size: VMM  allocates  as  much  memory as given by the memory
  549.               size gadget on startup.
  550. - Dynamic:    VMM  allocates  and  frees  memory  for  page frames as 
  551.               required during run-time.
  552. - Restricted dynamic:  This  works  identically to the dynamic option 
  553.              described  above  except  that  there will never be less
  554.              physical memory used for paging than the value specified
  555.              by  the  minimum  memory  slider  and  never  more  than 
  556.              specified by the maximum memory slider.
  557. @EndNode
  558. @Node "MemFlags_Gadget" "VMM/doc/VMM.guide/MemFlags_Gadget"
  559. @Next "WriteBuffer_Gadget"
  560. @Prev "MemType_Gadget"
  561. @Toc  "Main"
  562. Memory type for pageframes:
  563. This  gadget  determines  the  type  of  memory to be used for paging.
  564. Either  FAST,  CHIP  or  ANY can be selected.  Normally CHIP memory is
  565. inhibited  from  being  cached;  also on the A4000 pageframes lying in
  566. CHIP  RAM  can't be cached.  However on the A2000 with a 68040 card it
  567. might  be  possible that pageframes located in CHIP memory are cached,
  568. making  it  valuable  to use CHIP memory as a paging buffer to acquire
  569. more cacheable RAM.
  570. @EndNode
  571. @Node "WriteBuffer_Gadget" "VMM/doc/VMM.guide/WriteBuffer_Gadget"
  572. @Next "MemPri_Gadget"
  573. @Prev "MemFlags_Gadget"
  574. @Toc  "Main"
  575. Write buffer: 
  576. From  V2.1  VMM  uses  a write buffer in order to be able to write out
  577. several  pages  in  one  go.   This  results in a considerable speedup
  578. because it reduces disk seek times and overhead for I/O handling.
  579. With  the  write  buffer  slider  the  amount  of  memory dedicated to
  580. buffering  pages going out to disk can be determined.  Setting this to
  581. 0  disables write buffering.  Specifying an amount of 100 to 200 K for
  582. this should suffice for nearly all situations.
  583. @EndNode
  584. @Node "MemPri_Gadget" "VMM/doc/VMM.guide/MemPri_Gadget"
  585. @Prev "WriteBuffer_Gadget"
  586. @Next "SwapMedium_Gadget"
  587. @Toc  "Main"
  588. VM priority:
  589. Here you can select, when VM will be allocated.  Exec searches through
  590. all  memory  lists in a priority order with normal FAST memory usually
  591. at priority 30, CHIP at -10.  So if you want to allocate VM first, you
  592. have  to select a value larger than 30; if you want to use normal fast
  593. memory  first,  but  VM before CHIP memory, you have to select a value
  594. between  -10  and  30.   Dynamic  memory allocation works best with VM
  595. priority  being  the  highest  in  the system.  Otherwise all physical
  596. memory  will  already  be taken and VMM has to page all virtual memory
  597. into a small buffer, because it cannot enlarge it anymore.
  598. @EndNode
  599. @Node "SwapMedium_Gadget" "VMM/doc/VMM.guide/SwapMedium_Gadget"
  600. @Next "FileSize_Gadget"
  601. @Prev "MemPri_Gadget"
  602. @Toc  "Main"
  603. Swap medium:
  604. There are three possible mediums where to page to:
  605. - Paging  to  a  partition:   When  clicking  on  the popup gadget you
  606.   will  be asked for the partition you want to use for paging.  If you
  607.   select  a  partition for paging for the first time, VMM will ask you
  608.   if  you  really  want  to  overwrite that partition, so you need not
  609.   worry about destroying the wrong partition.
  610. - Paging  to  a  file:  When  clicking on the popup gadget you will be
  611.   asked for a filename used for paging.
  612. - Paging to a so-called pseudo-partition:  Pseudo-partitions are files
  613.   which  use a contiguous block on your harddisk.  As such they can be
  614.   listed, viewed and deleted just like normal files.  VMM creates this
  615.   kind  of  file  for  you  and  can  access  it using device commands
  616.   yielding  the  speed  of paging onto a partition while still using a
  617.   file.   If  the  file already exists VMM checks its consistency upon
  618.   startup  so  you  need  not worry about VMM overwriting part of your
  619.   partition.
  620.   Pseudo-partitions   currently  work  only  on  FFS  volumes  with  a
  621.   blocksize  of  512 bytes.  Because pseudo-partitions need contiguous
  622.   blocks  on your harddisk and FFS stores the root block in the middle
  623.   of  a  partition,  a pseudo-partition cannot be larger than half the
  624.   size  of  the volume it resides on.  A sentence of warning has to be
  625.   spoken here:  This is a very DANGEROUS option.  If there is a bug in
  626.   the  code creating and maintaining the pseudo-partition, VMM has the
  627.   potential  of  destroying  your partition.  However, I've thoroughly
  628.   tested this feature and never had any problems with it.
  629. This  parameter  and  the following page file size will not be updated
  630. until the next start of VMM.  It would be very hard and unnecessary to
  631. switch page files during runtime.
  632. @EndNode
  633. @Node "FileSize_Gadget" "VMM/doc/VMM.guide/FileSize_Gadget"
  634. @Prev "SwapMedium_Gadget"
  635. @Next "Misc_Settings"
  636. @Toc  "Main"
  637. Filesize:
  638. This  gadget  determines  the  size  of  the  paging  file  or  pseudo
  639. partition.
  640. This  parameter and the previous swap medium will not be updated until
  641. the  next  start  of  VMM.   It  would be very hard and unnecessary to
  642. switch page files during runtime.
  643. @EndNode
  644. @Node "Misc_Settings" "VMM/doc/VMM.guide/Misc_Settings"
  645. @Prev "FileSize_Gadget"
  646. @Next "PROC_DIFFS"
  647. @Toc "Main"
  648. Statistics:
  649. VMM  can  keep  a statistics window to inform you about parameter like
  650. the number of pagefaults, the amount of virtual memory used etc.  This
  651. can be turned on or off, turned into a simple titlebar and positioned.
  652. Cache Zorro II RAM:
  653. On  some  Amigas  with a 68040 card you have to disable the caching of
  654. RAM  in the range of 0 to $00ffffff (Zorro II addressing range).  This
  655. setting   is   ignored   if   the  VMM_MMU.config  file  generated  by
  656. ReadMMUConfig is used.
  657. Show VM in WB title:
  658. After  receiving  many  requests  to  patch the Workbench title bar in
  659. order  to  reflect  the  amount  of  free  virtual  memory  I  finally
  660. implemented   this.    As   this   patch   is   a  bad  hack  (patches
  661. SetWindowTitles()  and  compares the string title to "Amiga Workbench"
  662. or "AmigaOS 3.1") I decided to make it configurable.  That's what this
  663. button is for.
  664. Memory tracking:
  665. If  this  option  is  turned on, VMM tracks each allocation of virtual
  666. memory.   It  remembers the size of the allocation and the name of the
  667. task  that  allocated it.  With the VMMUsage program you can find out,
  668. how  much  virtual  memory a certain task uses.  The overhead for this
  669. option  is  rather  small,  so  you  will  probably  not even notice a
  670. slowdown  if  this  is  enabled.   However this is mainly intended for
  671. finding  out  tasks which don't work together with VMM without special
  672. care.
  673. If  you  change  the  settings of this option while VMM is running all
  674. requests  will  be  tracked while this option is on.  They will not be
  675. removed from the list when you turn this option off.
  676. Fast ROM:
  677. Turning  on this option will cause VMM to copy the ROM to FAST RAM and
  678. adjust  the  MMU tables such that the ROM addresses are mapped to this
  679. range.   This  greatly  speeds up ROM accesses on some machines.  This
  680. has been added since some tools which do this as well generate strange
  681. MMU settings which VMM is not able to handle.
  682. This  setting  is  ignored  if  the  VMM_MMU.config  file generated by
  683. ReadMMUConfig is used.
  684. Minimum VM allocation
  685. To  speed  up  the AllocMem routine which is heavily used by the whole
  686. system,  VMM  doesn't  allocate  VM for requests smaller than the size
  687. given  here.   This saves AllocMem the overhead of looking into a hash
  688. table  to  find out if the current task is allowed to use VM.  Setting
  689. this to zero will effectively cause VMM to look into its hash table on
  690. every AllocMem.  A value of 100 to 200 is reasonable.
  691. Hotkeys:
  692. There  are  two  additional hotkeys to enable or disable allocation of
  693. virtual memory during runtime.  The hotkey descriptions have to follow
  694. the  commodities  rules for hotkey descriptions.  The popup hotkey can
  695. only   be   specified  via  commandline  or  tooltypes  (according  to
  696. commodities setup).
  697. @EndNode
  698. @Node "PROC_DIFFS" "VMM/doc/VMM.guide/PROC_DIFFS"
  699. @Next "PROBLEMS"
  700. @Prev "Misc_Settings"
  701. @Toc "Main"
  702. 5. Processor differences
  703. There  are  certain  differences  in  the  implementation  due  to the
  704. different  processor  types.   The  68020+68851 and the 68030 stuff is
  705. very similar as well as the 68040 and 68060.
  706. First,  on  the  68030 VMM (nearly) always installs its own MMU table.
  707. This is because most 68030 machines either don't use the MMU at all or
  708. they  have  it  set to a different pagesize.  This means that Enforcer
  709. does  not  work on the 68030 together with VMM.  It uses a pagesize of
  710. 256  bytes.   From  V2.1  I  have  added a small hack which causes the
  711. machine  to  reload  the  kickfile  after  a  crash if you are using a
  712. softkicked  A3000.   This  feature  is not documented anywhere but has
  713. been proposed by Mike Sinz.
  714. @EndNode
  715. @Node "PROBLEMS" "VMM/doc/VMM.guide/PROBLEMS"
  716. @Next "TROUBLESHOOTING"
  717. @Prev "PROC_DIFFS"
  718. @Toc "Main"
  719. 6. PROBLEMS
  720. Commodore  defined  the  MEMF_PUBLIC  flag for the AllocMem function a
  721. long  time  ago,  when no-one knew what this would mean in the future.
  722. The  result  is that either people allocated all their memory with the
  723. MEMF_PUBLIC  flag set or they ignored it and never set it at all.  The
  724. first  way doesn't hurt VMM, but it prevents the corresponding program
  725. from  using  virtual  memory.  The second alternative is worse.  There
  726. are  a  lot  of programs, which allocate messages or IORequests on the
  727. stack,  which might produce a failure in a virtual memory environment.
  728. Such  programs  can  be  forbidden  to  use  virtual  memory using the
  729. preferences  program,  otherwise  spurious crashes may result.  If you
  730. are  considering  writing  programs  which  might benefit from virtual
  731. memory,  you should read the file "VMProgGuideline" to see what should
  732. be avoided in a virtual memory environment.
  733. Caching  programs  such  as FastCache or PowerCache should be disabled
  734. from  using  virtual memory (doesn't make sense to give virtual memory
  735. to  a  caching  program,  does it?).  The same applies to all programs
  736. that  patch  the BeginIO vector of the paging device.  When using disk
  737. caching  programs,  the file system tasks probably have to be disabled
  738. from  using  VM, too.  
  739. Programs  which use the Access Fault Trap Vector such as Enforcer have
  740. to  be  run before VMM, otherwise Enforcer will flag all pagefaults as
  741. invalid memory references.
  742. Code paging should not be used for programs which either contain input
  743. or  interrupt handlers.  An example for this is 'ixemul.library' which
  744. cannot be put into VM.
  745. @EndNode
  746. @Node "TROUBLESHOOTING" "VMM/doc/VMM.guide/TROUBLESHOOTING"
  747. @Next "TECHNICAL_DES"
  748. @Prev "PROBLEMS"
  749. @Toc "Main"
  750. 7. TROUBLESHOOTING
  751. Question: Program "X" doesn't use virtual memory. Why?
  752. Answer:   "X"  might  always allocate memory with the MEMF_PUBLIC flag
  753.           set.  Use  the  "advanced" section to enable this program to 
  754.           use VM.
  755. Question: VMM  crashes  with my configuration.
  756. Answer:   There  are  two  possibilities why this is happening. If VMM 
  757.           crashes  immediately upon startup or upon the first harddisk
  758.           access, it  is  probably a MMU setup problem. See @{"MMU setup" Link "MMU_SETUP"}
  759.           on  how  to cure this. The other possibility is that there's
  760.           a  program  running which doesn't work correctly with VM. If
  761.           this is the case, do the following:
  762.           Set  the  default  allocation to "Don't use VM" and move the
  763.           memory   slider  to  a  low  position,  so  there  are  many
  764.           pagefaults when  VMM  runs.   Then enable virtual memory for
  765.           each  task  in  your system one after another.  This way you
  766.           can  see, when the system crashes first.  You can disable VM
  767.           for  the  task  producing the crashes then. Additionally you 
  768.           can  use the @{"Memory tracking" Link "Misc_Settings"} feature to determine all tasks 
  769.           using VM.
  770. Question: VMM  sometimes  hangs  when  accessing a partition using the
  771.           same device as the paging partition. Why?
  772. Answer:   You  probably  have  a harddisk using DMA transfers with the
  773.           mask parameter for the filesystem set wrong. You have to use
  774.           either  HDToolbox or edit your mountlist to change the value
  775.           of  the  mask  parameter  for  all  partitions on the paging
  776.           device.  If  you  don't  know what the mask parameter means,
  777.           simply  set  it to 0xfffffe, limiting transfers to the lower
  778.           16 MB.  This error should not occur anymore from V2.0. If it
  779.           still does, please send me a mail.
  780. Question: My  disk-caching  program doesn't work even if disabled from 
  781.           using VM. Why?
  782. Answer:   Some  programs  patch  code  executed  by  other tasks. E.g.
  783.           DynamiCache patches the BeginIO vector of cached devices, so
  784.           that  all memory allocation for cache buffers is done not by
  785.           DynamiCache,  but  by  the  filesystem  task.   If this is a 
  786.           problem,  the  tasks  executing the patched code (here: DH0, 
  787.           DH1,...)  have  to  be disabled from using VM. For a problem 
  788.           regarding  the  copyback  cache  of  PowerCache  see section
  789.           @{"Known bugs" Link "KNOWN_BUGS"}.
  790. Question: VMM  crashes the machine when pressing either of the 'Save', 
  791.           'Use' or 'Cancel' button in the GUI.
  792. Answer:   You might not have a working MMU.
  793.           Unfortunately   there   is  no  way  to  find  out  if  your
  794.           processor   contains   a  working  MMU except looking at the
  795.           chip  and  watching out for an 'EC' sign.  If your processor
  796.           contains  those  two  letters  somewhere  in  its name (e.g.
  797.           68EC030)  the  MMU  in there is not fully functional and VMM
  798.           will  not  run  on  your  machine.   This can happen because
  799.           Motorola  sells  their processors as EC types if they failed  
  800.           their MMU test.  This might indicate only a small defect but
  801.           cannot be detected with quick tests.  This may cause SysInfo
  802.           to  report a working MMU. If your machine contains a working 
  803.           MMU it might be an MMU setup problem. See @{"MMU setup" Link "MMU_SETUP"}.
  804. Question: What are the pros and cons of 4K and 8K pages?
  805. Answer:   In  general  you  should  follow  the recommendations of the 
  806.           installer  script  which  pagesize  to use. Anyway VMM might
  807.           work with the other pagesize as well.
  808.           With  4K  pages  the  pagefault-rate  is  lower  on standard 
  809.           applications  than  with 8K pages. If you are doing a lot of
  810.           image  processing  with AdPro or the like, 8K pages might be
  811.           faster.  This generally applies to programs which access the
  812.           memory in a linear fashion.
  813. @EndNode
  814. @Node "TECHNICAL_DES" "VMM/doc/VMM.guide/TECHNICAL_DES"
  815. @Next "MMU_SETUP"
  816. @Prev "TROUBLESHOOTING"
  817. @Toc "Main"
  818. 8. TECHNICAL DESCRIPTION
  819. VMM  consists of three tasks, enabling the statistics window invokes a
  820. fourth.  The first one is the VM_Manager, which takes care of deciding
  821. which  task  is  allowed to use VM, initializing everything and so on.
  822. The  PageHandler  does the paging, when a pagefault has occurred.  The
  823. Prepager  causes  pages  to  be  locked  in  memory, when IO has to be
  824. carried out to or from VM using the paging device.  Most of the effort
  825. has  not been invested into getting the paging to run, but to make the
  826. system  use  VM  correctly  under  all  circumstances.   Unfortunately
  827. Commodore  hasn't  invested  much  thought  into the definition of the
  828. MEMF_PUBLIC  flag,  so quite a few system functions had to be patched.
  829. I  have tried to keep VMM as system-friendly as possible, but I had to
  830. make  a  few  assumptions, which are not documented.  The worst one is
  831. that  I  had  to  patch the Switch function, which changes a task from
  832. running state into the ready or wait state.  This means that VMM might
  833. not  run  in future versions of the OS, though I don't think Commodore
  834. will be changing much in such low level code.
  835. Commodore  also  didn't  state  anything about using non-public memory
  836. inside  Forbid/Permit or Disable/Enable.  Causing a pagefault inside a
  837. forbidden/disabled  section  is  dangerous,  because paging results in
  838. task switching.  Memory which should be freed inside such a section is
  839. freed when this section is completed.
  840. Currently  the  number  of  faults in progress plus the number of tasks
  841. using VM for their stack must not be more than 20 at any moment.
  842. The VM_Manager process
  843. The  VM_Manager  starts  up all other tasks and initializes most data.
  844. It  also  handles the quit request by the user.  Each time AllocMem is
  845. called, VMM has to decide whether the requesting process is allowed to
  846. use  VM.  The first time a task/process allocates memory, a message is
  847. sent  to  the  VM_Manager,  which decides if usage of VM is permitted.
  848. Subsequent  requests  by  the same task are dispatched quickly using a
  849. hash  table.   The manager process also handles all messages generated
  850. by pressing a hotkey or using the Exchange program.
  851. The PageHandler task
  852. All  paging  is  handled  asynchronously  by the page handler.  When a
  853. fault occurs, the parameters for such a fault are put into a so-called
  854. trap-struct by the trap-handling code.  This structure is then sent to
  855. the  pagehandler.   The  pagehandler  chooses a page to be evicted and
  856. possibly   writes   out   a   modified   page  first.   The  so-called
  857. second-chance  algorithm  is  used  for choosing a page to be evicted.
  858. When this process is finished, the required page is read in.  When the
  859. read  has  been successfully completed, the faulting task is signalled
  860. to  continue  its  computation.   During IO to the paging device other
  861. tasks  are  permitted  to  run  and eventually cause other pagefaults,
  862. which are handled immediately.
  863. VMM uses a write buffer for pages which are to be written to disk.  It
  864. collects  pages until the write buffer is full and writes them to disk
  865. in one go.  This dramatically decreases disk access times for paging.
  866. The Prepager task
  867. In  the process of writing VMM I have detected some cases, in which IO
  868. to  the  paging device is requested, e.g.  to another partition living
  869. on  the  same  physical device as the paging partition.  As the paging
  870. device  itself  must  never  block  for  a  pagefault,  this has to be
  871. prevented.   All  IO  to  the  paging  device  (except  that  from the
  872. pagehandler)  is examined for usage of virtual memory.  If it uses VM,
  873. the  corresponding  pages  are copied to a temporary buffer, the IO is
  874. carried out using that buffer, the pages are copied back if needed and
  875. the process requesting IO is permitted to continue.
  876. The statistics task
  877. The statistics task is only created, if statistics are enabled.  Every
  878. second  it  prints  a  few lines about usage of virtual memory and the
  879. number of pagefaults occurred so far.
  880. Patches to system functions
  881. The  following  Exec  functions  are patched by VMM:  Switch, AddTask,
  882. Wait,  AllocMem, FreeMem, AvailMem, CachePreDMA, CachePostDMA, LoadSeg
  883. and NewLoadSeg.
  884. On 68030 system ColdReboot is also patched to restore the original MMU
  885. table  before  reset.  Additionally the BeginIO function of the paging
  886. device  is  patched.  The Switch, Wait and AddTask functions had to be
  887. patched  because  the  stack  may  be  in  virtual memory.  To prevent
  888. pagefaults  while  in  supervisor  mode (task-switching), the stack is
  889. replaced  by  a  temporary stack large enough to contain all registers
  890. pushed  onto  the  stack  during  a  context switch.  When the task is
  891. re-launched, the original stack is used again.
  892. If  you  have  enabled  the display of virtual memory in the Workbench
  893. titlebar SetWindowTitles is also patched.
  894. @{"MMU setup"  Link "MMU_SETUP"}
  895. @EndNode
  896. @Node "MMU_SETUP" "VMM/doc/VMM.guide/MMU_SETUP"
  897. @Next "VMM_LIBRARY"
  898. @Prev "TECHNICAL_DES"
  899. @Toc "Main"
  900. The MMU setup used by VMM
  901. Whenever  possible  VMM  tries  to use an already installed MMU table.
  902. There  are certain cases when this is not possible such as a different
  903. pagesize than the one VMM uses or usage of certain hardware registers.
  904. (For   experts:   These  are  the  so-called  transparent  translation
  905. registers)   Some   boards  such  as  GVP's  GForce  '040  board,  the
  906. FusionForty  board  and some of GVP's harddisk controllers use address
  907. ranges  defined as reserved by Commodore.  There is no way to find out
  908. these  kind  of things.  
  909. In order to make VMM work together with those boards, I have created a
  910. special  way  to  tell VMM about its MMU setup.  There's a tool called
  911. 'ReadMMUConfig'  which  can read the current MMU setup for the whole 4
  912. GB  address  range.  This information is written to a file and read by
  913. VMM  upon  startup.  The file generated by this tool contains one line
  914. for  each contiguously mapped chunk of memory.  VMM generates an equal
  915. map,  which  does  not  use  those  special  registers  and  the right
  916. pagesize.   
  917. From  V3.1  I have made this mapping dynamic, i.e.  the memory for the
  918. pagetables  is  only  allocated  after an address is first used.  This
  919. should  not  generate  any  problems  like in earlier versions.  If it
  920. still  does  you might have to edit the VMM_MMU.config file by hand so
  921. following is a description of what each entry means:
  922. Each line contains the following four entries:
  923. log. start address | phys. start address | blocklength | flags
  924. This means a block starting at 'log. start address' maps to 'phys.
  925. start address' for 'blocklength' bytes. The flags for this region
  926. are the following:
  927. Bit 0 must always be set.
  928. Bit 1 must always be cleared.
  929. Bit 2 must be set if this region should be write-protected.
  930. Bit 3 and 4 are ignored.
  931. Bit 5 and 6 reflect the caching mode as follows:
  932. Bit 6 | Bit 5 |          68040             |      68030 and 68851
  933. ------+-------+----------------------------+--------------------------
  934.   0   |   0   | Cacheable, write-through   |      Cacheable
  935.   0   |   1   | Cacheable, copyback        |      Cacheable
  936.   1   |   0   | Noncacheable, serialized   |      Noncacheable
  937.   1   |   1   | Noncacheable               |      Noncacheable
  938. If  you cannot get it to work by modifying this file yourself, send me
  939. a  mail  with  the  output  of the 'ReadMMUConfig' file, the output of
  940. ShowConfig  or  similar  and I will try to assist you in setting up an
  941. MMU table which will work.
  942. @EndNode
  943. @Node "VMM_LIBRARY" "VMM/doc/VMM.guide/VMM_LIBRARY"
  944. @Next "EXT_PROGS"
  945. @Prev "MMU_SETUP"
  946. @Toc "Main"
  947. 9. VMM.LIBRARY
  948. A  library has been added to the VMM distribution as requested by some
  949. people.   It  contains  functions  for AllocVMem, FreeVMem, AvailVMem,
  950. AllocVVec  and  FreeVVec.   When  the library is first loaded, the VMM
  951. pagehandler  is  automatically  installed.   Only  programs  using the
  952. function calls of vmm.library will get virtual memory.  If you wish to
  953. use  vmm.library  and  the standard way of getting VM, you have to use
  954. VMM  just  like  before.   Currently the pagehandler is not terminated
  955. when the library is expunged.  A doc file for the library functions in
  956. Autodoc format is included.
  957. @EndNode
  958. @Node "EXT_PROGS" "VMM/doc/VMM.guide/EXT_PROGS"
  959. @Next "KNOWN_BUGS"
  960. @Prev "VMM_LIBRARY"
  961. @Toc "Main"
  962. 10. EXTERNAL PROGRAMS
  963. From V2.1 it is possible to write your own statistics display program.
  964. You  can  add  graphical  output  and  additional computations such as
  965. average page fault rate and so on.  There's an include file describing
  966. the  message  structure  you  have  to  send  to VMM to acquire status
  967. information.   See  that include file for further information.  If you
  968. write  a  nice program you can send it to me and I might include it in
  969. the next release.
  970. From  V3.0  the  usage statistics can also be retrieved by an external
  971. program.   So  if you don't like VMMUsage, or you would like to have a
  972. combined  display  for  statistics and VM usage you can write your own
  973. program.  The way to retrieve the necessary information is depicted in
  974. the same include file as the statistics info.
  975. @EndNode
  976. @Node "KNOWN_BUGS" "VMM/doc/VMM.guide/KNOWN_BUGS"
  977. @Next "BUG_REPORTING"
  978. @Prev "EXT_PROGS"
  979. @Toc "Main"
  980. 11. KNOWN BUGS
  981. As far as I know there are no major bugs in VMM.  However there is one
  982. minor  bug  which still has to be corrected.  If a task is removed via
  983. RemTask  from  another  task and it uses virtual memory for its stack,
  984. the TrapStruct is currently not released.  Commodore recommends not to
  985. call  RemTask  on  another  task  and it isn't done very often in real
  986. programs.   One  possibility is to prevent the task that allocates the
  987. stack for such programs from using virtual memory.
  988. It  can happen that VMM cannot startup due to lack of memory.  In this
  989. case  it  should  bring  up  a  requester  stating  this fact.  If the
  990. requester  cannot  be  created,  there  will  be  no  message  at  all
  991. indicating   the  reason  of  failure.   This  is  due  to  a  bug  in
  992. EasyRequestArgs,  as  there is no way to find out if the requester was
  993. successful  or not.  In future OS versions (if there will be any) this
  994. should produce a recoverable alert.
  995. There's a strange phenomenon in conjunction with console.device.  When
  996. you  open  a  new  CLI  window,  sometimes  the cursor remains ghosted
  997. although  the window is activated.  Activating another window and then
  998. again the new console window will activate the cursor.  The 'CON' task
  999. seems  to  allocate its stack in VM and that produces the problem.  If
  1000. you disable 'CON' from using VM this problems disappears.
  1001. There's a bug in conjunction with the copyback mode of PowerCache.  It
  1002. causes  file  contents  to  be  garbled.   This  is  rather  a  bug in
  1003. PowerCache than in VMM.  In the current version of PowerCache (37.115)
  1004. there's  are  two  choices:   either you have to turn off the copyback
  1005. cache of PowerCache or you have to set the mask (in HDToolbox) for all
  1006. partitions on the paging device to 0xfffffff (limits accesses to lower
  1007. 256 MB). I hope this will be fixed in future versions of PowerCache.
  1008. There's  a  strange  phenomenon in conjunction with Workbench.  If you
  1009. try to copy a large file (min.  10 MB) to RAM:  using the Workbench it
  1010. will  fail for lack of memory even if your paging partition or file is
  1011. large  enough.   If you do the same from the CLI all works fine.  This
  1012. is a bug of Workbench.  I have tried this without VMM running but with
  1013. 16 MB Fast RAM in my machine and the same error turns up.
  1014. VMM  patches  the  LoadSeg  library  vector to accomplish code paging.
  1015. Unfortunately  this  patch  cannot  simply  call  the original LoadSeg
  1016. function  when  it  is done.  This means that patches to this function
  1017. like  e.g.   SegTracker applied before VMM is started are not executed
  1018. for  programs  which  are loaded into virtual memory.  This has become
  1019. necessary because the OS often does not call its own functions via the
  1020. official (patchable) vectors.
  1021. @EndNode
  1022. @Node "BUG_REPORTING" "VMM/doc/VMM.guide/BUG_REPORTING"
  1023. @Next "ACKNOWLEDGMENTS"
  1024. @Prev "KNOWN_BUGS"
  1025. @Toc "Main"
  1026. 12. BUG REPORTING
  1027. If  you  wish  to report a bug or propose an enhancement to VMM please
  1028. use  the  bug-report  form  which  can  be  found  in this archive.  I
  1029. frequently  cannot answer questions because I don't know which version
  1030. of  VMM  people  are  referring to, which hardware they use and so on.
  1031. This is the reason the bug-report form is important for me.
  1032. You can find my address under @{"Miscellaneous" Link "MISCELLANEOUS"}.
  1033. @EndNode
  1034. @Node "ACKNOWLEDGMENTS" "VMM/doc/VMM.guide/ACKNOWLEDGMENTS"
  1035. @Next "MISCELLANEOUS"
  1036. @Prev "BUG_REPORTING"
  1037. @Toc "Main"
  1038. 13. ACKNOWLEDGMENTS
  1039. I would like to thank the following people for ideas, improvements and
  1040. beta-testing of VMM (in alphabetical order).
  1041. Michael Berg                  (Danish translation)
  1042. rgen Barthmann
  1043. Wayne Cole
  1044. Torsten Ebeling
  1045. Markus Eiblmeier
  1046. Sven Fischer
  1047. Frank Grimm
  1048. Magnus Holmgren               (Swedish translation)
  1049. Robert Kiehne
  1050. Jeff Koons
  1051. Steve Koren
  1052. Andree Maedl
  1053. Manfred Matzinger
  1054. Barry McConnell
  1055. Marco Musso                   (Italian translation)
  1056. Paul Ney
  1057. Stefan Odendahl
  1058. Hans Otten
  1059. Volker Rudolph                (for helping me with the 68030 port)
  1060. Stefan Schmidt
  1061. Torsten Stolpmann
  1062. Erno Tuomainen
  1063. Emmanuel Vacher               (French translation)
  1064. Nikola Vukovljak
  1065. Alg Inge Wang
  1066. Christian Wasner
  1067. Juergen Zimmermann
  1068. I also want to thank all those people who sent me mail with wishes and
  1069. bug reports. Without them VMM wouldn't work as well as it does.
  1070. @EndNode
  1071. @Node "MISCELLANEOUS" "VMM/doc/VMM.guide/MISCELLANEOUS"
  1072. @Prev "ACKNOWLEDGMENTS"
  1073. @Toc "Main"
  1074. 14. MISCELLANEOUS
  1075. I  would  be glad to hear from you, if VMM works on your machine, what
  1076. programs  have  difficulties  in  running  with  VMM.  If you report a
  1077. bug PLEASE use the bug-report form which can be found in this archive.
  1078. Because  most  bugs  seem  to  be  very hardware dependent I need your
  1079. configuration data to find out what happens.
  1080. email:      apel@tecmath.de
  1081. snail-mail: Martin Apel
  1082.             Gerhart-Hauptmann-Str.5
  1083.             67663 Kaiserslautern
  1084.             Germany 
  1085. phone:      0631 / 24257
  1086. bank account: 145 009 494
  1087. at:           Sparkasse Bonn 
  1088.               BLZ 380 500 00
  1089. @EndNode
  1090.